//*手机适屏*
$(function(){
    ddhqr();
	$(".list .inner").click(function(event){

        $(".list .inner>div").hide();
        $(this).children("div").show();
        event.stopPropagation();    

    });
    $(".title1 span>img").click(function(event){
        $(".title1 span>span").hide();
        $(this).next("span").show();
        event.stopPropagation();   
    });
    $("body").click(function(){

        $(".list .inner>div").hide(); 
        $(".title1 span>span").hide();

    });

    $("#ddhh").click(function(){
        var a=$("#ddhh").text();
        var flag = copyText(a);//这个必须在DOM对象的事件线程中执行
        alert(flag ? "复制成功！" : "复制失败！");
    });
    

    function copyText(text) {
        var textarea = document.createElement("textarea");
        var currentFocus = document.activeElement;
        document.body.appendChild(textarea);
        textarea.value = text;
        textarea.focus();
        if (textarea.setSelectionRange)
            textarea.setSelectionRange(0, textarea.value.length);
        else
            textarea.select();
        try {
            var flag = document.execCommand("copy");
        } catch(eo){
            var flag = false;
        }
        document.body.removeChild(textarea);
        currentFocus.focus();
        return flag;
    }




    function ddhqr(){
		//alert('1');
		var formData =new FormData();
		formData.append("ddh",$("#ddhhidden").text());
		
		$.ajax({ 
			url: './bg/image.jsp?ddh='+$("#ddhhidden").val() , 
			type: 'post', 
			data: formData, 
			cache: false,
			processData: false,
			contentType: false,
			async: true,
			dataType: "json",
			beforeSend: function(){
				//alert('4');
				//$('#submit-span').html('上传中...');
			},
			success: function(data){
				if(data.status=="error"){
					//alert('2');
					//alert("您上传的图片无法识别，请重新上传");					
				}else{
					$(".qr").empty();
                    //$(".qr").append("<img src='http://weixin.shcei.com.cn/imgupload/"+data.src+"'>");
					//$(".qr").addClass("qrtop");
					$(".qr").append("<img src='http://weixin.shcei.com.cn/imgupload/"+data.src+"'>");
				}
			},
			error: function(XMLHttpRequest, textStatus, errorThrown){  
        //alert(XMLHttpRequest.readyState + XMLHttpRequest.status + XMLHttpRequest.responseText);  
    }  
		})
	}

function isMobile() {
        var userAgentInfo = navigator.userAgent;
    
        var mobileAgents = [ "Android", "iPhone", "SymbianOS", "Windows Phone", "iPad","iPod"];
    
        var mobile_flag = false;
    
        //根据userAgent判断是否是手机
        for (var v = 0; v < mobileAgents.length; v++) {
            if (userAgentInfo.indexOf(mobileAgents[v]) > 0) {
                mobile_flag = true;
                break;
            }
        }
    
         var screen_width = window.screen.width;
         var screen_height = window.screen.height;    
    
         //根据屏幕分辨率判断是否是手机
         if(screen_width < 500 && screen_height < 800){
             mobile_flag = true;
         }
    
         return mobile_flag;
    }
     var mobile = isMobile(); // true为PC端，false为手机端

     if(mobile)
     {
         $(".list li").css({"width":"25vw","margin-left":"3vw","margin-right":"3vw","margin-top":"3vw"});
         $(".list").css({"padding":"0px 3vw"});
    }else{
        
        $(".list li").css({"width":"90px","margin-left":"30px","margin-right":"0px","margin-top":"0px"});
        $(".list").css({"padding":"0"});
    }
    
});
